home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 39
/
Aminet 39 (2000)(Schatztruhe)[!][Oct 2000].iso
/
Aminet
/
mus
/
misc
/
AampPlaylistCo.lha
/
AampPlaylistConvert-r
/
AampPlaylistConvert-r.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-08-13
|
4KB
|
114 lines
#include <fstream.h>
char *vers = "$VER: AampPlaylistConvert-r 1.1 [13. August 2000]";
int errors=0;
int main(int argc, char **argv)
{
short idx=0, idx2=0, contin=1;
char buffer[500], path[200], artist[31], title[31], seconds[6];
fstream ein, aus;
cout <<"| AampPlaylistConvert-r 1.1 |"<<endl;
cout <<"| by radiat-r@Sascha-Ploss.de |"<<endl;
if (argc == 3)
{
ein.open(argv[1],ios::in);
if (ein.is_open())
{
aus.open(argv[2],ios::out);
if (aus.is_open())
{
ein.getline(buffer,500);
while (!ein.eof() && contin)
{
idx=0;
while ((buffer[idx] != '\t') && (buffer[idx] != '\0'))
{
path[idx]=buffer[idx];
idx++;
}
if (buffer[idx] != '\0')
{
path[idx]='\0';
idx++;
idx2=0;
while (!((buffer[idx] == ' ') && (buffer[idx+1] == '-') && (buffer[idx+2] == ' ')) && (buffer[idx] != '\0'))
{
artist[idx2]=buffer[idx];
idx++;
idx2++;
}
if (buffer[idx] != '\0')
{
artist[idx2]='\0';
idx+=3;
idx2=0;
while ((buffer[idx] != '\t') && (buffer[idx] != '\0'))
{
title[idx2]=buffer[idx];
idx++;
idx2++;
}
if (buffer[idx] != '\0')
{
title[idx2]='\0';
idx++;
idx2=0;
while ((buffer[idx] != ' ') && (buffer[idx] != '\0'))
{
seconds[idx2]=buffer[idx];
idx++;
idx2++;
}
if (buffer[idx] != '\0')
{
seconds[idx2]='\0';
aus <<path<<"\t"<<artist<<"\t"<<title<<"\t"<<seconds<<" seconds"<<endl; // You can change this line to produce your own output format
ein.getline(buffer,200);
}
else
{
cout <<"Error, either inputfile does not need to be converted or is not a playlistfile at all."<<endl;
contin=0;
}
}
else
{
cout <<"Error, either inputfile does not need to be converted or is not a playlistfile at all."<<endl;
contin=0;
}
}
else
{
cout <<"Error, either inputfile does not need to be converted or is not a playlistfile at all."<<endl;
contin=0;
}
}
else
{
cout <<"Error, either inputfile does not need to be converted or is not a playlistfile at all."<<endl;
contin=0;
}
}
}
else // aus.is_open
{
cout <<"Error while opening outputfile: "<<argv[2]<<endl;
errors++;
}
}
else // ein.is_open
{
cout <<"Error while opening inputfile: "<<argv[1]<<endl;
errors++;
}
}
else // argc >< 3
{
cout <<"Error, wrong number of arguments,\nUsage: "<<argv[0]<<" Inputfile Outputfile"<<endl;
errors++;
}
return errors;
}